
// import { createRequire } from 'module'
// const require = createRequire(import.meta.url)

const shell = require('shelljs')
// 39.106.131.145
const cmd =
  'cd dist && zip -q -r dist.zip * && ssh root@101.42.46.250 "rm -rf /www/wwwroot/hjzx.svc/public/store/*" && scp dist.zip root@101.42.46.250:/www/wwwroot/hjzx.svc/public/store && ssh root@101.42.46.250 "cd /www/wwwroot/hjzx.svc/public/store && unzip -o dist.zip && rm -f dist.zip"'
// 异步回调
// 执行 git add . 命令
shell.exec(cmd, function (code, stdout, stderr) {
  console.log('Exit code:', code)
  console.log('Program output:', stdout)
  console.log('Program stderr:', stderr)
  if (code === 0) {
    console.log('提交至服务器成功！')
    // shell.exec(removeDist, function () {
    //   console.log('删除dist.zip文件完成！')
    // })
  } else {
    console.log('提交失败！')// 我是呼叫中心后台
  }
})
